﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="原料明细账.aspx.cs" Inherits="syc.Store.原料明细账" %>
<html>
<head></head>
<body>
<asp:Label ID="SqlText" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="SelectedID" runat="server" Text="0" Visible="false"></asp:Label>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
onselected="SqlDataSource1_Selected" ></asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>" 
SelectCommand="SELECT [ID],品名,规格 as 规格 FROM 原料">
</asp:SqlDataSource>
<asp:DropDownList ID="GuiGe" runat="server" 
DataSourceID="SqlDataSource2" DataTextField="规格" DataValueField="ID" Visible="false">
</asp:DropDownList>

<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">
<div id="wintop" class="wintop">原材料明细账</div>
<asp:Panel ID="Panel1" runat="server" CssClass="panel">
    <asp:Button ID="Button_View" runat="server" Text="查看单据" CssClass="button" Enabled="false" UseSubmitBehavior="false" />
    <asp:Button ID="Button_Export" runat="server" Text="导出Excel" CssClass="button" Enabled="false" Font-Bold="false" UseSubmitBehavior="false" onclick="Button_Export_Click" />
</asp:Panel>


<asp:Panel ID="Panel2" runat="server" CssClass="panel" GroupingText="查 询">
    <span style="display:inline-block;width:60px;text-align:right;">原料类别：</span><asp:DropDownList ID="YuanLiao" runat="server" 
    DataSourceID="SqlDataSource2" DataTextField="品名" DataValueField="ID" Width="115px">
    </asp:DropDownList>
    <span style="display:inline-block;width:86px;text-align:right;">起始日期：</span><asp:TextBox
        ID="Date1" runat="server" Width="115px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" />
    <span style="display:inline-block;width:70px;text-align:right;">截止日期：</span><asp:TextBox
        ID="Date2" runat="server" Width="115px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date2').value, document.getElementById('Date2'));" />
    <asp:Button ID="Button_Query" runat="server" Text="查 询" CssClass="button" onclick="Button_Query_Click"  />
</asp:Panel>

<asp:Panel ID="Panel4" runat="server" CssClass="panel2">
    <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt"></asp:Label>
</asp:Panel>
    
<div class="gridframe">
    <div class="gridview">
    
        <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
            <tr>
	            <td class="grid-title">原材料明细账</td>
	        </tr>
	        <tr>
	            <td class="grid-back">
                    <asp:GridView ID="GridView1" runat="server" 
                        AutoGenerateColumns="False" CssClass="grid" DataKeyNames="ID,数量,单据ID" 
                        DataSourceID="SqlDataSource1" 
                        GridLines="None" ondatabound="GridView1_DataBound" 
                        onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
                        UseAccessibleHeader="False" 
                        onselectedindexchanged="GridView1_SelectedIndexChanged" PageSize="20" 
                        onrowdatabound="GridView1_RowDataBound" ShowFooter="True" >
                        <PagerSettings Visible="False" />
                        <RowStyle CssClass="grid-row-normal" />
                        <Columns>
                                                       
                            <asp:TemplateField HeaderText="">
                                <ItemTemplate>
                                    <asp:Button ID="Button1" runat="server" CommandName="Select" Text="选择" CssClass="hide"/>
                                    <img src="/Icons/online.gif" style="margin-top:2px;" alt="" />
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="20px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="日期">
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("日期","{0:d}") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="70px" />
                            </asp:TemplateField>
                                                        
                            <asp:TemplateField HeaderText="供货或使用">
                                <ItemTemplate>
                                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("供货或使用") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Left" Width="120px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="单价(元)">
                                <ItemTemplate>
                                    <asp:Label ID="Label5" runat="server" Text='<%# Bind("单价") %>'></asp:Label>
                                </ItemTemplate>
                                <FooterTemplate>
                                    <asp:Label ID="Label21" runat="server" Text="合计："></asp:Label>
                                </FooterTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Right" Width="90px" />
                                <FooterStyle HorizontalAlign="Right" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="收入数量">
                                <ItemTemplate>
                                    <asp:Label ID="Label6" runat="server" Text='<%# Bind("收入数量") %>'></asp:Label>
                                </ItemTemplate>
                                <FooterTemplate>
                                    <asp:Label ID="Label22" runat="server" Text=""></asp:Label>
                                </FooterTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Right" Width="80px" />
                                <FooterStyle CssClass="grid" HorizontalAlign="Right" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="收入金额(元)">
                                <ItemTemplate>
                                    <asp:Label ID="Label7" runat="server"></asp:Label>
                                </ItemTemplate>
                                <FooterTemplate>
                                    <asp:Label ID="Label23" runat="server" Text=""></asp:Label>
                                </FooterTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Right" Width="80px" />
                                <FooterStyle CssClass="grid" HorizontalAlign="Right" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="支出数量">
                                <ItemTemplate>
                                    <asp:Label ID="Label8" runat="server" Text='<%# Bind("支出数量") %>'></asp:Label>
                                </ItemTemplate>
                                <FooterTemplate>
                                    <asp:Label ID="Label24" runat="server" Text=""></asp:Label>
                                </FooterTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Right" Width="80px" />
                                <FooterStyle CssClass="grid" HorizontalAlign="Right" />
                            </asp:TemplateField>
                            

                            <asp:TemplateField HeaderText="支出金额(元)">
                                <ItemTemplate>
                                    <asp:Label ID="Label9" runat="server"></asp:Label>
                                </ItemTemplate>
                                <FooterTemplate>
                                    <asp:Label ID="Label25" runat="server" Text=""></asp:Label>
                                </FooterTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Right" Width="80px" />
                                <FooterStyle CssClass="grid" HorizontalAlign="Right" />
                            </asp:TemplateField>
                     
                     
                            <asp:TemplateField HeaderText="结存数量">
                                <ItemTemplate>
                                    <asp:Label ID="Label10" runat="server" Text='<%# Bind("结存数量") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Right" Width="80px" />
                            </asp:TemplateField>
                            

                            <asp:TemplateField HeaderText="结存金额(元)">
                                <ItemTemplate>
                                    <asp:Label ID="Label11" runat="server" Text='<%# Bind("结存金额") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Right" Width="80px" />
                            </asp:TemplateField>
                           
                        </Columns>
                        <SelectedRowStyle CssClass="grid-row-selected" />
                      </asp:GridView>
	            </td>
            </tr>
            <tr>
	            <td>   
	                <table width="100%">
	                    <tr>
	                        <td class="pagebar">
                                <asp:Button ID="Button_Pager_First" runat="server" Text="" ToolTip="首页" 
                                    CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                <asp:Button ID="Button_Pager_Prev" runat="server" Text="" ToolTip="上一页" 
                                    CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                <input type="button" class="page-split" />第<asp:TextBox ID="TextBox_Pager" runat="server" CssClass="pageturn" 
                                    ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" /><asp:Label ID="Label_Pages" runat="server"></asp:Label><input type="button" class="page-split" />
                                
                                <asp:Button ID="Button_Pager_Next" runat="server" Text="" ToolTip="下一页" 
                                    CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                <asp:Button ID="Button_Pager_Last" runat="server" Text="" ToolTip="末页" 
                                    CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" />
                            </td>
                            <td class="pagebar" align="right">
                                <asp:Label ID="Label_Total" runat="server"></asp:Label>
                            </td>
                        </tr>
                   </table>

	            </td>
            </tr>
        </table>
    </div>
</div>

</form>
<script>
    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }

    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
            rows[i].onclick = function() { this.firstChild.firstChild.click(); };
        }
    }
    var tds = document.getElementsByTagName("td");
    for (i = 0; i < tds.length; i++) {
        if (tds[i].className == "detailheader") {
            tds[i].innerHTML = tds[i].innerHTML.replace("*", "<span class=required>*</span>");
        }
    }

    function pick(o) {
        obj.value = o.title;
        if (obj == document.getElementById("Date1")) {
            document.getElementById("Date2").value = obj.value;
        }
        hidecalendar();
        obj.fireEvent("onchange");
    }
    function picktoday() {
        obj.value = today.getFullYear() + "年" + (today.getMonth() + 1) + "月" + today.getDate() + "日";
        if (obj == document.getElementById("Date1")) {
            document.getElementById("Date2").value = obj.value;
        }
        hidecalendar();
        obj.fireEvent("onchange");
    }
    parent.hidesubmenu(true);
</script>
</body>
</html>
